package com.example.androidproject.ui.fragment;

import android.app.Activity;
import android.view.View;
import android.widget.Button;

import com.example.androidproject.R;
import com.example.androidproject.net.RetrofitHelper;
import com.example.androidproject.ui.base.IBaseFragment;
import com.hyg.base.ui.base.BasePresenter;
import com.hyg.base.ui.common.FragmentContainerActivity;
import com.hyg.common.utils.ToastUtils;
import com.hyg.idea.net.common.APICallback;

import butterknife.BindView;

/**
 * FileName: TestMvcFragment
 * Author: huangyuguang
 * Date: 2022/5/11
 * Description: mvc
 */
public class TestMvcFragment extends IBaseFragment {
    @BindView(R.id.btn)
    Button button;

    public static void launch(Activity from){
        FragmentContainerActivity.getInstance().launch(from, TestMvcFragment.class);
    }

    @Override
    public String initTitle() {
        return "试试看MVC";
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    public int setNewFragmentContainerView() {
        return R.layout.comm_fragment_container1;
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initViewAndData() {
        button.setText("hahah");
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.show("哈哈哈");
            }
        });
    }

    private void getTestData(){
        RetrofitHelper.getApiService().getTest()
                .compose(rxSchedulerHelper(true))
                .subscribe(new APICallback<String>() {
                    @Override
                    public void onSuccess(String response) {
                    }

                    @Override
                    public void onFail(String message) {
                        super.onFail(message);
                    }
                });
    }
}
